package github.fafaovo.common.mycapability;

import net.minecraft.nbt.CompoundNBT;

public class SpeedUpCapability implements ISpeedUpCapability {
    private float level;

    public SpeedUpCapability(int level) {
        this.level = level;
    }

    @Override
    public float getLevel() {
        return level;
    }

    @Override
    public void setLevel(float level)
    {
        this.level = level;
    }
    //让他具备序列化的能力 [网络传输] 类变成字节
    @Override
    public CompoundNBT serializeNBT() {
        CompoundNBT compoundNBT = new CompoundNBT();
        compoundNBT.putFloat("level", this.level);
        return compoundNBT;
    }

    @Override
    public void deserializeNBT(CompoundNBT nbt) {
        this.level = nbt.getFloat("level");
    }
}
